package com.ilop.sthome.ui.activity.config;

import android.Manifest;
import android.graphics.drawable.AnimationDrawable;

import com.example.common.base.BaseBindActivity;
import com.ilop.sthome.utils.system.AppUtil;
import com.example.common.utils.PermissionUtil;
import com.siterwell.familywellplus.R;
import com.siterwell.familywellplus.databinding.ActivityAddGatewayGuideBinding;

/**
 * @author skygge
 * @date 2019-10-10.
 * GitHub：javofxu@github.com
 * email：skygge@yeah.net
 * description：配网引导页
 */
public class AddGatewayGuideActivity extends BaseBindActivity<ActivityAddGatewayGuideBinding> {

    @Override
    protected int getLayoutId() {
        return R.layout.activity_add_gateway_guide;
    }

    @Override
    protected void initialize() {
        super.initialize();
        PermissionUtil.requestPermission(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION});
    }

    @Override
    protected void initView() {
        super.initView();
        mDBind.ivGatewayShow.setBackgroundResource(R.drawable.config_tishi);
        AnimationDrawable mAnimation = (AnimationDrawable) mDBind.ivGatewayShow.getBackground();
        mAnimation.start();
    }

    @Override
    protected void initListener() {
        super.initListener();
        mDBind.ivBeforeBack.setOnClickListener(v -> finish());
        mDBind.btConfigNext.setOnClickListener(view -> {
            if(AppUtil.isLocServiceEnable(mContext)){
                skipAnotherActivity(NetWorkActivity.class);
                finish();
            }else {
                showToast(getString(R.string.permission_reject_location_service_tip));
            }
        });
    }
}
